<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // catch
        // 本质是then方法专门用来指定失败回调的语法糖(简洁语法)
        //  如果前面是成功的promise, catch返回成功的promise => 将成功promise向下传递
        //如果前面是失败的promise, catch返回的promise由它指定的回调执行的结果决定
    

    new Promise((resolve, reject) => {
      resolve(111)
    }).catch(reason => {
      console.log('1')
    }).then(value => {
      console.log('2', value)
    })

    new Promise((resolve, reject) => {
      // reject(1)
      resolve(2)
    })
    .then(
      value => value,
      reason => {
        console.log('123456789')
      }
    )

    new Promise((resolve, reject) => {
      reject(2222)
    }).catch(reason => {
      console.log('12345')
    }).then(value => {
      console.log('2')
    })

    </script>
</body>
</html>